<?php
//if (isset($_SESSION['username'])) {
include_once 'header.php';
require_once("../conn.php");
$db = new DBC();

$id = "";
$announce = "";
$status = "";
if (isset($_GET['id'])) {
    $sql = "SELECT * FROM t_announce WHERE id = " . $_GET['id'];
    $data = $db->fetchData($sql);
    if (count($data) > 0) {
        $id = $data[0]['id'];
        $announce = $data[0]['announce'];
        $status = $data[0]['status'];
        $isModify = 1;
    }
} else {
    $isModify = 0;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>乐知家园</title>
        <style type="text/css">
            <!--
            body,td,th {
                font-family: 微软雅黑;
                font-size: 14px;
                color: #CCCCCC;
            }

            .text{
                height:20px;
            }
            .disable{
                background-color:#CCCCCC;
            }
            -->
        </style>
        <script language="javascript">
            function onSubmitCheck(){
                var announce = document.getElementById("announce").value;

                var isok = true;
                if(announce==""){
                    alert("\u8bf7输入编码");
                    isok = false;
                }
                if(!isok){
                    event.returnValue = false;
                }
            }
        </script>
        <script type="text/javascript" src="js/jQuery.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#age").change(function(){
                    $.get("getPackByAge.php?age=1", function(data){
                        var obj = jQuery.parseJSON(data);
                        $('#packselect').children().remove().end();
                        $("#packselect").append('<option value="-1">\u65e0</option>');
                        for(var i=0;i<obj.length;i++){
                            var option = "<option value="+obj[i].packid+">"+obj[i].packcode+"-"+obj[i].name+"</option>";
                            $("#packselect").append(option);
                        }
                    });
                });
            });
        </script>
    </head>

    <body>
        <?php
        if (!isset($announce)) {
            $announce = "";
        }
        ?>
        <br/>
        <form id="form1" name="form1" method="post" action="announce.action.php" enctype="multipart/form-data">
            <table width="50%" border="0" align="center" cellpadding="1" cellspacing="1">
                <tr>
                    <td height="30" bgcolor="#666666">公告<input name="id" type="hidden" size="50" value="<?php echo $id; ?>"/></td>
                    <td bgcolor="#9999FF"><textarea id="annouce" name="announce" style="width: 500; height: 300;"><?php echo $announce; ?></textarea></td>
                </tr>
                <tr>
                    <td height="30" bgcolor="#666666">&nbsp;<input name="isModify" type="hidden" size="50" value="<?php echo $isModify; ?>"/></td>
                    <td bgcolor="#9999FF">
                        <input type="submit" name="Submit" value="提交" onclick="onSubmitCheck()" />                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
<?php

function has($type, $num) {
    if (strpos($type, $num) >= 0) {
        return true;
    }
    return false;
}

include_once '../footer.php';
//} else {
//    header("login.php");
//}
?>
